var xmlhttp;
if (window.XMLHttpRequest){
    //IE7+,Fire,Chrome,Opera,Safari
    xmlhttp = new XMLHttpRequest();

}
else {
    xmlhttp =new  ActiveXObject("Micosoft.XMLHTTP");
}
var news_content =document.getElementById("news_content");
//HTTP是无状态，定义一些状态值表述当前HTTP的性质
//404
//定义回掉函数
xmlhttp.onreadystatechange =function () {
    if(xmlhttp.readyState ===4 &&xmlhttp.status===200) {

        //news_content.innerHTML = xmlhttp.responseText;
        showJson(JSON.parse(xmlhttp.responseText));

    }
}
//HTTP访问方法
xmlhttp.open("GET","top250.json",true);
xmlhttp.send();
function showJson (jsonDate) {
    document.getElementById("title").innerText =jsonDate.title;
    var temHtml ="";
    for (var i =0;i<10;i++){
        //temHtml +="<li>"+jsonDate.subjects[i].title+"</li>\n";
        //document.getElementById("news_list").innerHTML =temHtml;
        temHtml +="<li>";
        temHtml +=jsonDate.subjects[i].title;
        temHtml +="<img src=\"";
        temHtml +=jsonDate.subjects[i].images.medium;
        temHtml +="\" alt=\"";
        temHtml +=jsonDate.subjects[i].title;
        temHtml +="\">";
        temHtml +="<>";


    }

}